import request from '@/utils/request'

// 所有店铺列表
export const getShopListAPI = () => {
  return request.get('/audit/shop/list')
}

// 更新店铺状态
export const updateShopStatusAPI = (data: { id: number, status: number,remark: string }) => {
  return request.post('/audit/shop/status', data)
}


// 所有待审核商户列表
export const getShopAuditListAPI = () => {
  return request.get('/audit/shop/list/zero')
}


// 指定商户资质信息
export const getShopAuditInfoAPI = (id: number) => {
  return request.get(`/audit/shop/get/${id}`)
}

//
// 根据用户ID查询店铺
export const getShopByUserIdAPI = () => {
  return request.get(`/shop/user`)
}

// 上传店铺营业执照
export const uploadShopLicenseAPI = (file: File,id: number) => {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('id', id.toString())
  return request.post('/shop/uploadLicense', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}


// 新增
export const addShopAPI = (data: { name: string, phone: string, email: string, licenseFile: string,address: string }) => {
  return request.post('/shop/insert', data)
}
